package com.rill.service;

import java.util.Date;

import com.rill.dao.ArticleClickNumDao;
import com.rill.po.ArticleClickNum;

public class ArticleClickServiceImpl implements ArticleClickService {
	private ArticleClickNumDao articleClickNumDao ;//需要dao来实现
	public ArticleClickNumDao getArticleClickNumDao() {
		return articleClickNumDao;
	}
	public void setArticleClickNumDao(ArticleClickNumDao articleClickNumDao) {
		this.articleClickNumDao = articleClickNumDao;
	}
	@Override
	public boolean isVistor(int artId, String ip, Date time) {
		//判断是否已经点击过
		if((articleClickNumDao.queryById(artId, ip, time)).size()!=0){//已经点击
			return true;
		}else{
			//没有点击，增加新的记录
			ArticleClickNum click = new ArticleClickNum();
			click.setArtId(artId);
			click.setIp(ip);
			click.setTime(time);
			articleClickNumDao.addVistRecord(click);
			return false;
		}
	}
}
